package it.univpm.diiga.memorysim.views;

import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.ViewPart;
import org.eclipse.swt.widgets.Label;

public class Helper extends ViewPart {

	public static final String ID = "it.univpm.diiga.memorysim.views.Helper";
	private Composite top = null;
	private Label label = null;

	@Override
	public void createPartControl(Composite parent) {
		top = new Composite(parent, SWT.NONE);
		top.setLayout(new GridLayout());
		label = new Label(top, SWT.NONE);
		label.setText("<Area per la presentazione del programma\n dei credici ecc..>");
		Button butt=new Button(top,SWT.NONE);
		butt.setText("CHIUDI");
		butt.setVisible(false);
		butt.addSelectionListener(new SelectionListener(){

			@Override
			public void widgetDefaultSelected(SelectionEvent e) {
				
			}

			@Override
			public void widgetSelected(SelectionEvent e) {
				IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
				window.getActivePage().findView(Helper.ID).dispose();				
			}
			
		});
	}

	@Override
	public void setFocus() {
		// TODO Auto-generated method stub
		
	}

}
